<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body>
        <p>点击按钮就可以执行 <em>displayDate()</em> 函数。</p>
        <button onclick="displayDate()">点击这里</button>
        <script>
            function displayDate() {
                document.getElementById("demo").innerHTML = Date();
            }
        </script>
        <p id="demo"></p>
    </body>
</html>